﻿using System;

namespace Ndns.ServerHost.Abstractions
{
    public interface IServiceBuilder
    {
        IServiceBuilder Add(Type serviceType, object serviceObject);
    }

    public static class ServiceBuilderExtensions
    {
        public static IServiceBuilder Add<TService>(this IServiceBuilder builder, TService serviceObject)
        {
            return builder.Add(typeof(TService), serviceObject);
        }

        public static IServiceBuilder Add<TService, TServiceImplementation>(this IServiceBuilder builder, TServiceImplementation serviceObject) where TServiceImplementation : TService
        {
            return builder.Add(typeof(TService), serviceObject);
        }
    }
}
